package com.usian.common.exception;

import com.usian.model.common.dtos.ResponseResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class ExceptionCatch {
//    @ExceptionHandler(Exception.class)
//    @ResponseBody
//    public ResponseResult AppException(Exception e){
//        e.printStackTrace();
//        return ResponseResult.errorResult(500,"请稍后再试");
//    }
////分母为零
//    @ExceptionHandler(ArithmeticException.class)
//    @ResponseBody
//    public ResponseResult ArithmeticException(ArithmeticException arithmeticException){
//        arithmeticException.printStackTrace();
//        return ResponseResult.errorResult(501,"分母为零");
//    }
////    空指针异常
//    @ExceptionHandler(NullPointerException.class)
//    @ResponseBody
//    public ResponseResult NullPointerException(NullPointerException nullPointerException){
//        nullPointerException.printStackTrace();
//        return ResponseResult.errorResult(502,"空指针");
//    }
//
////    下标越界异常
//    @ExceptionHandler(IndexOutOfBoundsException.class)
//    @ResponseBody
//    public ResponseResult IndexOutOfBoundsException(IndexOutOfBoundsException indexOutOfBoundsException) {
//        indexOutOfBoundsException.printStackTrace();
//        return ResponseResult.errorResult(503,"下标索引越界");
//
//    }


}
